/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "nombre_vivienda_entorno", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "NombreViviendaEntorno.findAll", query = "SELECT n FROM NombreViviendaEntorno n"),
    @NamedQuery(name = "NombreViviendaEntorno.findByIdNombreViviendaEntorno", query = "SELECT n FROM NombreViviendaEntorno n WHERE n.idNombreViviendaEntorno = :idNombreViviendaEntorno"),
    @NamedQuery(name = "NombreViviendaEntorno.findByNveNombre", query = "SELECT n FROM NombreViviendaEntorno n WHERE n.nveNombre = :nveNombre")})
public class HousingEnvironmentName implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_nombre_vivienda_entorno")
    private Integer id;
    @Column(name = "nve_nombre")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "housingEnvironmentName")
    private List<HousingEnvironmentData> housingEnvironmentData;
    @JoinColumn(name = "tve_id_tipo_vivienda_entorno", referencedColumnName = "id_tipo_vivienda_entorno")
    @ManyToOne(optional = false)
    private HousingEnvironmentType housingEnvironmentType;

    public HousingEnvironmentName() {
    }

    public HousingEnvironmentName(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<HousingEnvironmentData> getHousingEnvironmentData() {
        return housingEnvironmentData;
    }

    public void setHousingEnvironmentData(List<HousingEnvironmentData> housingEnvironmentData) {
        this.housingEnvironmentData = housingEnvironmentData;
    }

    public HousingEnvironmentType getHousingEnvironmentType() {
        return housingEnvironmentType;
    }

    public void setHousingEnvironmentType(HousingEnvironmentType housingEnvironmentType) {
        this.housingEnvironmentType = housingEnvironmentType;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HousingEnvironmentName)) {
            return false;
        }
        HousingEnvironmentName other = (HousingEnvironmentName) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.HousingEnvironmentName[ id=" + id + " ]";
    }
    
}
